/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;

/**
 *
 * @author Team 3958
 */
public class logitechController extends Joystick {
     
    double leftAxis = 0;
    double rightAxis = 0;
    
   public logitechController(int port) {
        super(port, 6, 10);

        setAxisChannel(AxisType.kX, 1);
        setAxisChannel(AxisType.kY, 2);
        
        
        
        
//        m_axes[AxisType.kX.value] = kDefaultXAxis;
//        m_axes[AxisType.kY.value] = kDefaultYAxis;
//        m_axes[AxisType.kZ.value] = kDefaultZAxis;
//        m_axes[AxisType.kTwist.value] = kDefaultTwistAxis;
//        m_axes[AxisType.kThrottle.value] = kDefaultThrottleAxis;
//
//        m_buttons[ButtonType.kTrigger.value] = kDefaultTriggerButton;
//        m_buttons[ButtonType.kTop.value] = kDefaultTopButton;
    }
   
   /*
    * For the reset() function, when it is called upon in the code,
    * the two variables will call on their respective axies and store 
    * whatever value it reads. The 'if' statements that follow tell what 
    * to do when one variable is less than / greater than 0. In particular we want to pay attention to the 
    * yAxis variable - that one goes on our wayward right stick. For now,
    * only mathematical calculations will be done and will be assigned to 
    * respecive variables.
    */
   
   public void reset() {
       leftAxis = getRawAxis(2);
       rightAxis = getRawAxis(5);
       
       double leftOffset = 0;
       double rightOffset = 0;
       
       if (leftAxis < 0) {
          leftOffset = -(-1 - leftAxis);
       } else if (leftAxis > 0) {
          leftOffset = 1 - leftAxis;
       } else {
           leftOffset = leftAxis; // Essentially setting it to 0.
       }
       
       if (rightAxis < 0) {
          rightOffset = -(-1 - rightAxis);
       } else if (rightAxis > 0) {
          rightOffset = 1 - rightAxis;
       } else {
           rightOffset = rightAxis; // Essentially setting it to 0.
       }
   }

}
